package com.zzyl.controller.manager;

import com.zzyl.base.PageBean;
import com.zzyl.base.ResponseResult;
import com.zzyl.dto.AlertDataHandleDto;
import com.zzyl.dto.AlertDataPageQueryDto;
import com.zzyl.service.AlertDataService;
import com.zzyl.vo.AlertDataVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/alert-data")
@Api(tags = "报警数据相关接口")
public class AlertDataController {

    @Autowired
    AlertDataService alertDataService;

    //TODO @ApiOperation(value = "分页查询报警数据")
    @GetMapping("/pageQuery")
    public ResponseResult<PageBean<AlertDataVo>> query(AlertDataPageQueryDto dto) {
        PageBean<AlertDataVo> alertDataVoPageBean = alertDataService.adminPageQuery(dto);
        return ResponseResult.success(alertDataVoPageBean);
    }

    //TODO @ApiOperation("处理设备报警数据")
    @PutMapping("handleAlertData/{id}")
    public ResponseResult<Void> update(@RequestBody AlertDataHandleDto dto, @PathVariable Long id) {
        alertDataService.handleAlertData(id, dto);
        return ResponseResult.success();
    }
}